//
//  PayListCollectionViewCell.m
//  LocalGoods2
//
//  Created by Feihong Ye on 2018/10/26.
//  Copyright © 2018年 Xiaodong Huang. All rights reserved.
//

#import "PayListCollectionViewCell.h"
#import "Header.h"

@interface PayListCollectionViewCell ()
@property (nonatomic, strong) UIImageView *goodsImage;// 图片
@property (nonatomic, strong) UILabel *titleLabel;// 标题
@property (nonatomic, strong) UILabel *contentLabel;// 内容
@property (nonatomic, strong) UIImageView *payCarImage;// 购物车
@property (nonatomic, strong) UILabel *priceLabel;// 价格
@property (nonatomic, strong) UILabel *discountLabel;// 折扣价格
@property (nonatomic, strong) UIView *deleteView; // 划去原价

@end
@implementation PayListCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        
        [self setUpUI];
    }
    
    return self;
}
- (void)setUpUI {
    self.goodsImage = [[UIImageView alloc] init];
    self.goodsImage.image = image(@"YUSHI3");
    [self.contentView addSubview:_goodsImage];
    [_goodsImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.offset(0);
        make.height.equalTo(self.goodsImage.mas_width);
    }];
    self.titleLabel = [[UILabel alloc] init];
    _titleLabel.text = @"新疆和田玉褐皮白玉籽玉挂件 弥勒 13.6克";
    _titleLabel.numberOfLines = 0;
    _titleLabel.font = [UIFont systemFontOfSize:11];
    [self.contentView addSubview:_titleLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(10);
        make.right.offset(-10);
        make.top.equalTo(self.goodsImage.mas_bottom).offset(10);
    }];
    
    self.priceLabel = [[UILabel alloc] init];
    _priceLabel.text = @"¥ 1";
    _priceLabel.font = [UIFont systemFontOfSize:22];
    _priceLabel.textColor = [UIColor redColor];
    [self.contentView addSubview:_priceLabel];
    [_priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.titleLabel);
        make.bottom.offset(-10);
    }];
    
    self.deleteView = [[UIView alloc] init];
    _deleteView.backgroundColor = [UIColor blackColor];
    _deleteView.hidden = YES;
    [self.contentView addSubview:_deleteView];
    [_deleteView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.priceLabel).offset(-2);
        make.right.equalTo(self.priceLabel).offset(2);
        make.centerY.equalTo(self.priceLabel);
        make.height.offset(0.5);
    }];
    
    self.discountLabel = [[UILabel alloc] init];
    self.discountLabel.text = @"折: ¥ 0.1";
    _discountLabel.hidden = YES;
    [_discountLabel setLabelFont:[UIFont systemFontOfSize:12] toText:@"折: "];
    [self.contentView addSubview:_discountLabel];
    [_discountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.priceLabel.mas_right).offset(5);
        make.bottom.equalTo(self.priceLabel);
    }];
    
    self.contentLabel = [[UILabel alloc] init];
    self.contentLabel.text = @"24411人付款";
    _contentLabel.font = [UIFont systemFontOfSize:10];
    _contentLabel.textColor = [UIColor colorFromRed:153 green:153 bule:153];
    [self.contentView addSubview:_contentLabel];
    [_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.offset(-10);
        make.bottom.equalTo(self.discountLabel);
    }];
    
}

@end
